import request from '@/router/axios';

export const getList = (current, size, params) => {
  return request({
    url: '/api/mes-admin/sequencedefinition/page',
    method: 'get',
    params: {
      ...params,
      current,
      size
    }
  });
};

export const getDetail = (id) => {
  return request({
    url: '/api/mes-admin/sequencedefinition/detail',
    method: 'get',
    params: {
      id
    }
  });
};

export const getSqlName = (id) => {
  return request({
    url: '/api/mes-admin/datasql/detail',
    method: 'get',
    params: {
      id
    }
  });
};
export const getDetailLabel = (partId) => {
  return request({
    url: '/api/mes-product/process/label',
    method: 'get',
    params: {
      partId
    }
  });
};

export const remove = (ids) => {
  return request({
    url: '/api/mes-admin/sequencedefinition/remove',
    method: 'post',
    params: {
      ids
    }
  });
};

export const add = (row) => {
  return request({
    url: '/api/mes-admin/sequencedefinition/submit',
    method: 'post',
    data: row
  });
};

export const addOrUpdate = (row) => {
  return request({
    url: '/api/mes-admin/sequencedefinition/submit',
    method: 'post',
    data: row
  });
};

export const getDefault = (params) => {
  return request({
    url: '/api/mes-admin/label-print-config/get-print-config',
    method: 'POST',
    params: {
      ...params,
      type: 'MATERIAL'
    }
  });
};

// 配置默认SCM规则
export const setDefaultScmRule = (id) => {
  return request({
    url: '/api/mes-admin/sequencedefinition/scm-default',
    method: 'get',
    params: {
      id
    }
  });
};
// 获取系统默认scm规则和模版
export const getScmDefault = () => {
  return request({
    url: '/api/mes-admin/vendor/get-scm-default',
    method: 'get'
  });
};
